package org.ymy2;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo {

    public static void main(String[] args) throws Exception {

        String lastTime = "2020/05/28 14:10";
        String currentTime = "2020/05/28 15:12";

        SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm");
        Date fromDate = simpleFormat.parse(lastTime);
        Date toDate = simpleFormat.parse(currentTime);
        long from = fromDate.getTime();
        long to = toDate.getTime();

        // 分钟差
        Long useTime = new Long((to - from) / (1000 * 60));

        System.out.println(useTime);
    }
}
